# eric7.Testing.Interfaces.PytestRunner

Module implementing the test runner script for the 'pytest' framework.

### Global Attributes

command
writer

### Classes

EricPlugin | Class implementing a pytest plugin which reports the data in a format suitable for the PytestExecutor.
GetMarkersPlugin | Class implementing a pytest plugin to extract the list of all defined markers.
GetPluginVersionsPlugin | Class implementing a pytest plugin to extract the version info of all installed plugins.

### Functions

getMarkers | Function to determine the defined markers and their descriptions.
getVersions | Function to determine the framework version and versions of all available plugins.

## EricPlugin

Class implementing a pytest plugin which reports the data in a format suitable for the PytestExecutor.

### Derived from

None

### Class Attributes

None

### Class Methods

None

### Methods

EricPlugin | Constructor
__initializeReportData | Private method to initialize attributes for data collection.
pytest_collectreport | Public method called by pytest after the tests have been collected.
pytest_itemcollected | Public malled by pytest after a test item has been collected.
pytest_report_header | Public method called by pytest before any reporting.
pytest_runtest_logfinish | Public method called by pytest after a test has been completed.
pytest_runtest_logreport | Public method called by pytest when a test phase (setup, call and teardown) has been completed.
pytest_runtest_logstart | Public method called by pytest before running a test.
pytest_sessionfinish | Public method called by pytest after the whole test run finished.
pytest_sessionstart | Public method called by pytest before performing collection and entering the run test loop.

### Static Methods

None

#### EricPlugin (Constructor)

EricPlugin(writer)

Constructor

writer (EricJsonWriter)
  reference to the object to write the results to

#### EricPlugin.__initializeReportData

__initializeReportData()

Private method to initialize attributes for data collection.

#### EricPlugin.pytest_collectreport

pytest_collectreport(report)

Public method called by pytest after the tests have been collected.

report (CollectReport)
  reference to the report object

#### EricPlugin.pytest_itemcollected

pytest_itemcollected(item)

Public malled by pytest after a test item has been collected.

item (Item)
  reference to the collected test item

#### EricPlugin.pytest_report_header

pytest_report_header(config)

Public method called by pytest before any reporting.

config (Config)
  reference to the configuration object

#### EricPlugin.pytest_runtest_logfinish

pytest_runtest_logfinish(nodeid, location)

Public method called by pytest after a test has been completed.

nodeid (str)
  node id of the test item
location (tuple of (str, int, str))
  tuple containing the file name, the line number and the test name

#### EricPlugin.pytest_runtest_logreport

pytest_runtest_logreport(report)

Public method called by pytest when a test phase (setup, call and teardown) has been completed.

report (TestReport)
  reference to the test report object

#### EricPlugin.pytest_runtest_logstart

pytest_runtest_logstart(nodeid, location)

Public method called by pytest before running a test.

nodeid (str)
  node id of the test item
location (tuple of (str, int, str))
  tuple containing the file name, the line number and the test name (unused)

#### EricPlugin.pytest_sessionfinish

pytest_sessionfinish(session, exitstatus)

Public method called by pytest after the whole test run finished.

session (Session)
  reference to the session object (unused)
exitstatus (int or ExitCode)
  exit status (unused)

#### EricPlugin.pytest_sessionstart

pytest_sessionstart(session)

Public method called by pytest before performing collection and entering the run test loop.

session (Session)
  reference to the session object (unused)

Up

## GetMarkersPlugin

Class implementing a pytest plugin to extract the list of all defined markers.

### Derived from

None

### Class Attributes

None

### Class Methods

None

### Methods

GetMarkersPlugin | Constructor
getMarkers | Public method to get the assembled list of markers.
pytest_cmdline_main | Public method called for performing the main command line action.

### Static Methods

None

#### GetMarkersPlugin (Constructor)

GetMarkersPlugin()

Constructor

#### GetMarkersPlugin.getMarkers

getMarkers()

Public method to get the assembled list of markers.

Return:
  list of collected markers (marker name as key and description as value)

Return Type:
  dict

#### GetMarkersPlugin.pytest_cmdline_main

pytest_cmdline_main(config)

Public method called for performing the main command line action.

config (Config)
  pytest config object

Up

## GetPluginVersionsPlugin

Class implementing a pytest plugin to extract the version info of all installed plugins.

### Derived from

None

### Class Attributes

None

### Class Methods

None

### Methods

GetPluginVersionsPlugin | Constructor
getVersions | Public method to get the assembled list of plugin versions.
pytest_cmdline_main | Public method called for performing the main command line action.

### Static Methods

None

#### GetPluginVersionsPlugin (Constructor)

GetPluginVersionsPlugin()

Constructor

#### GetPluginVersionsPlugin.getVersions

getVersions()

Public method to get the assembled list of plugin versions.

Return:
  list of collected plugin versions

Return Type:
  list of dict

#### GetPluginVersionsPlugin.pytest_cmdline_main

pytest_cmdline_main(config)

Public method called for performing the main command line action.

config (Config)
  pytest config object

Up

## getMarkers

getMarkers()

Function to determine the defined markers and their descriptions.

Up

## getVersions

getVersions()

Function to determine the framework version and versions of all available plugins.

Up